class Person {
    name: string;
    age: number
    constructor(name: string, age: number) {
        this.name = name;
        this.age = age;
    }
    jump(a: string): string {
        return a + this.name
    }
    static run(x: number): number {
        return x
    }
}
let tom = new Person('tom', 18);
console.log(tom.jump('aa'));
console.log(Person.run(5));


interface Anima {
    sound(str: string): string,
    weight(num: number): number
}


interface Anima1 {
    name(str: string): string
}

class Cat implements Anima, Anima1 {
    sound(a: string): string {
        return a
    }
    weight(num: number): number {
        return num
    }
    name(str: string): string {
        return str
    }

}



let kitty = new Cat();
console.log(kitty);
console.log(kitty.sound('喵喵'));
console.log(kitty.sound('汪汪的叫了'));



interface DogInP {
    sound(str: string): string,
}

interface DogInC {
    run(num: number): number
}



interface NewIn extends DogInP, DogInC {

}
class Dog implements NewIn {
    sound(str: string): string {
        return str
    }
    run(num: number): number {
        return num
    }
}

let dahuang = new Dog()
console.log(dahuang.sound('汪汪汪'));
console.log(dahuang.run(100));


class Students extends Person {
    sex: string;
    constructor(name: string, age: number, sex: string) {
        super(name, age);
        this.sex = sex;
    }
    jump(a: string): string {
        return super.jump(a);
    }
}
let sizhe = new Students('sizhe', 15, "男");
console.log(sizhe.jump('2米高'));


class Book {
    // 
    public name: string;
    private price: string;
    protected pages: number;
    constructor(name: string, price: string, pages: number) {
        this.name = name;
        this.price = price;
        this.pages = pages;
    }
    sayBookName(): string {
        console.log(this.price);
        console.log(this.pages);
        return this.name
    }
}


let hongloumeng = new Book('hongloumeng', '200块', 1500);
console.log(hongloumeng.name);
console.log(hongloumeng);
console.log(hongloumeng.sayBookName());

class HouBook extends Book {
    constructor(name: string, price: string, pages: number) {
        super(name, price, pages);
    }
    testPrice() {
        console.log(this.name);
        // console.log(this.price);
        console.log(this.pages);

    }
}

let xiaohongshu = new HouBook('hongshu', '10块', 1000);
console.log(xiaohongshu.testPrice());

export {
    tom,
}

